/*
 *  Forest.cpp
 *  lab3
 *
 *  Created by Fredrik Gustafsson on 2010-12-06.
 *  Copyright 2010 KTH. All rights reserved.
 *
 */

#include "Forest.h"

using namespace wok2;

Forest::Forest(std::string n_name, std::string n_description) : Outside(n_name, n_description) {
	name = n_name;
	description = n_description;
}

Forest::~Forest() {
}

std::string Forest::type() const {
	return "forest";
}

void Forest::print_room() {
	std::cout << description << std::endl;
	int new_berries = rand()%4;
	if (new_berries == 1){
		std::cout << "A berry grew!" << std::endl;
	}
	else if (new_berries>1){
		std::cout << "Some berries grew!" << std::endl;
	}

	while (new_berries-->0) {
		Berry* berry;
		switch (rand()%4) {
			case 0:
				berry = new Berry("lingonberry", "A delicious lingon berry");
				break;
			case 1:
				berry = new Berry("raspberry", "A red enchanting raspberry");
				break;
			case 2:
				berry = new Berry("strawberry", "A red berry with green dots");
				break;
			case 3:
				berry = new Berry("fraise", "A yummy berry, looking like a mini-strawberry");
				break;
				
			default:
				break;
		}
#ifdef DEBUG_ALLOC
		std::cout << "*DBG* Allocated:" << berry->name << std::endl;
#endif
		this->push_item(berry);

	}
	print_actors();
	print_items();
	std::cout << "Exits: " ;
	print_directions();
}